
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                            type.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                                    Forrest Yu, 2005
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

#ifndef	_ORANGES_TYPE_H_
#define	_ORANGES_TYPE_H_

/* routine types */
#define	PUBLIC		/* PUBLIC is the opposite of PRIVATE */
#define	PRIVATE	static	/* PRIVATE x limits the scope of x */

#define	MAX_MSG_BUFF	10
#define MAX_WIN_NUM	20
#define ROOT_WIN 9999

typedef	unsigned long long	u64;
typedef	unsigned int		u32;
typedef	unsigned short		u16;
typedef	unsigned char		u8;

typedef	char *			va_list;

typedef	void	(*int_handler)	();
typedef	void	(*task_f)	();
typedef	void	(*irq_handler)	(int irq);

typedef void*	system_call;

enum MessageType{
	MsgMouse,
	MsgKeyboard
};
/**
 * MESSAGE mechanism is borrowed from MINIX
 */
struct mess1 {
	int m1i1;
	int m1i2;
	int m1i3;
	int m1i4;
};
struct mess2 {
	void* m2p1;
	void* m2p2;
	void* m2p3;
	void* m2p4;
};
struct mess3 {
	int	m3i1;
	int	m3i2;
	int	m3i3;
	int	m3i4;
	u64	m3l1;
	u64	m3l2;
	void*	m3p1;
	void*	m3p2;
};
struct Window{
	unsigned int ID;
	unsigned int x;
	unsigned int y;
	unsigned int Height;
	unsigned int Width;
	unsigned int Type;//Form 0, CloseButton 1, Maximize 2, Minimize 3, Taskbar 4, ItemTask 5,Label 6
	unsigned int Father;
	int Visible;
	int Alive;
	int HaveLabel;
	char Label[100];
	int Maximized;
	int Minimized;
};
typedef struct {
	enum MessageType Type;
	unsigned char LeftButtonDown;
	unsigned char RightButtonDown;
	unsigned char PressedKey;
	unsigned int MouseX;
	unsigned int MouseY;
	int BelongsTo;
	int source;
	int type;
	union {
		struct mess1 m1;
		struct mess2 m2;
		struct mess3 m3;
	} u;
} MESSAGE;
struct MessageQueue{	int Head;
	int Tail;
	MESSAGE Queue[MAX_MSG_BUFF];};


#endif /* _ORANGES_TYPE_H_ */
